package dec;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: fzykd
 * Date: 2023-05-08
 * Time: 19:34
 */

public class Decorator extends Drink{
    //这个类是装饰者 就是咖啡的配料

    //这个类 聚合了 Drink
    private Drink obj;

    public Decorator(Drink obj){
        this.obj = obj;
    }


    @Override
    public float cost() {
        //getPrices是自己的价格
        return super.getPrice() + obj.getPrice();
    }


    @Override
    public String getDes() {
        //obj.getDes 是被装饰者的信息
        return super.des + " " +  super.getPrice() + " && " + obj.getDes();
    }
}
